<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page language="java" import="com.tjtt.common.utils.DateUtilsAll"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <base target="_self"/>
    <link rel="stylesheet" type="text/css" href="<%=path %>/web/style/layout.css" />
    <script type="text/javascript" src="<%=path %>/jqGrid/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<%=path %>/jslib/jquery.validate.min.js"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/My97DatePicker/WdatePicker.js" defer="defer"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/jquery.form.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/additional-methods.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/demo.css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    <c:if test="${requestScope.message!=null}">
		<script type="text/javascript">
 	 		     alert('<c:out value="${requestScope.message}"></c:out>');
 	 		     window.close();
 		</script>
	</c:if>
	
    <script type="text/javascript">
    var api = frameElement.api, W = api.opener;
    var stateValue="";
    $().ready(function(){
            
			var options = {
		  	    url:'<%=request.getContextPath() %>/wentifankui!addWentifankui.action',
		  	     beforeSubmit: function() {
		   				return checking();
		    			},
		  	    dataType:'json',
		  	    success: function(data) {
		  	    //alert(data);
		  	      if(data.result=='success'){
					alert("添加成功");
				//	window.close();
					api.close();
					W.refreshIt();
		  	      }
		  	    }};
		$('#saveBtn').click(function(){
			    	$('#pageFrom').ajaxSubmit(options);
	 	            return false;
    	 });
    	$('#closeBtn').click(function(){
    		api.close();
			//window.close();
		});
		
	});
	
   	function checking(){
   		var flag = true;
		var fankuineirong = $.trim($("#fankuineirong").val());
		var fankuijieshoufang = $.trim($("#fankuijieshoufang").val());
		if(fankuineirong ==null || fankuineirong == "" ){
			alert("问题描述不能为空！");
			$("#fankuineirong").focus();
    		return false;
		}
		if(fankuijieshoufang == null && fankuijieshoufang == ""){
			alert("接收人不能为空！");
			$("#jieshoufangname").focus();
    		return false;
		}
		
	}
	 
	function checkExp(inputData){ 
		var regEx = new RegExp(/^(([^\^\.<>%&',:;=?$"'#@!~\]\[{}【】￥（）！·‘’”“。，、？：；—|\/\\/`\|])*)$/);
		var result = inputData.match(regEx);
		if (result == null) {
			return false;
		}
		return true;
	}
	function checkNum(inputData){
		var sNumber;
	    sNumber=Number(inputData);
	    if (isNaN(inputData)){
	       return false;
	     }
	    return true;
	}
	function countlen1(textarea){
	       var elem = event.relatedTarget || event.srcElement || event.target ||event.currentTarget;    
	        if(event.keyCode!=8)
			{
			  if (textarea.value.length> 249){
			        alert("最多为250个字符,字符输入超出限制!");
			        textarea.value=textarea.value.substring(0,249);
			    }
			    return true;
	 	    }
	}
	//选择人员	
	function selectUser(flag){
	    var users = window.showModalDialog("<%=request.getContextPath()%>/system/chooseAllUser.jsp?temp="+Math.round(Math.random()*10000),'',"dialogWidth=900px;dialogHeight=500px");
    	if (users != null) {
    		var userIds = [];
            var userNames = [];
            for(var i=0;i<users.length;i++){
                userIds.push(users[i]['userid']);
                userNames.push(users[i]['username']);
            }
            document.getElementById("jieshoufangname").value = userNames.join();
            document.getElementById("fankuijieshoufang").value = userIds.join();
    	}
	}

   </script>
 	<style type="text/css">
 		body{
 			background:#ffffff; background-image:url(images/);
 		}
   		html{
		    overflow-x: hidden;
			overflow-y: hidden;
		}  	
		.formTableNew textarea{border: 1px solid #999;padding: 5px;width: 760px;-moz-border-radius: 3px;border-radius: 3px;margin-bottom: 5px;color: #666;background: url(../images/input_bg.gif) repeat-x top;}
   </style>
  </head>
  
  <body>
<form id="pageFrom" action="" enctype="multipart/form-data" method="post">
        <input type="hidden" id="flag" name="flag" />
        <input type="hidden" id="wentifankuiid" name="wentifankuiid" value="${requestScope.id }"/>
        <input type="hidden" id="taskid" name="taskid" value="${requestScope.taskid }"/>
        <input type="hidden" id="stateid" name="stateid" value="${requestScope.stateid }"/>
  		<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew">
  			<tr>
  			  <td align="right">委托单识别号：</td>
  			   <td align="left">
  			    <input  type="text" readonly id="shibiehao" maxlength="50" name="shibiehao" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${weituodansbh }" />
  			   </td>
  			</tr>
  			<tr>
  			  <td align="right">问题描述：</td>
  			  <td align="left">
  			    <textarea rows="7" cols="100" id="fankuineirong" name="fankuineirong" onkeydown="countlen1(this);" style="width: 250px;"></textarea>
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  </tr>
  			<tr>
  			  <td align="right">反馈日期：</td>
  			   <td align="left">
  			    <input  type="text" readonly id="fankuiriqi" maxlength="50" name="fankuiriqi" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="<%=DateUtilsAll.dateToStringShort(new Date()) %>" />
  			   </td>
  			</tr>
  			<tr>
  			  <td align="right">接收人：</td>
  			  <td align="left">
  			    <input type="hidden" id="fankuijieshoufang" name="fankuijieshoufang" value=""/>
  			    <input  type="text" readonly id="jieshoufangname" maxlength="50" name="jieshoufangname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="" />
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			     <img src="<%=request.getContextPath()%>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectUser()" /> 
  			  </td>
  			  </tr>
  			<tr>
  			  <td align="right">附件：</td>
  			   <td align="left">
  			    <jsp:include page="../fileupload/attachment.jsp?id=${requestScope.id }&column=fujian&show=n" ></jsp:include>
  			   </td>
  			</tr>
		</table>
		<table width="100%" border="0" align="center" class="formTableNew">
		  <tr>
			<td align="center">
		    	<input id="saveBtn" type="button" value="提 交" class="form_bt_orange" />
		    	<input type="button" id="closeBtn" value="取 消" class="form_bt_grey" />
		    </td>
		  </tr>
		</table>
	<!--表单结束-->
	</form>
 
  </body>
</html>
